﻿using Learun.Util;
using SqlSugar;
using System;
namespace Learun.Application.TwoDevelopment.ZZDT_EC

{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-07-04 10:00
    /// 描 述：同步关联表。项目复制时，需要同步的表，然后这些表的相关表也需要同步 
    /// </summary>
    [SugarTable(TableName = "ec_synrel_table")]
    public class ec_synrel_tableEntity 
    {
        #region 实体成员
        /// <summary>
        /// 同步关联表ID
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsPrimaryKey = true)]
        public string SynRelTableID { get; set; }
        /// <summary>
        /// 主业务表ID，<see cref="ec_business_tableEntity.BusinessTableID"/>"/>
        /// </summary>
        /// <returns></returns>
        public string MainBusinessTableID { get; set; } = "";
        /// <summary>
        /// 关联业务表ID，<see cref="ec_business_tableEntity.BusinessTableID"/>"/>
        /// </summary>
        /// <returns></returns>
        public string RelBusinessTableID { get; set; } = "";
        /// <summary>
        /// 创建人
        /// </summary>
        /// <returns></returns>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        /// <returns></returns>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        /// <returns></returns>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.SynRelTableID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.SynRelTableID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion

        #region 扩展字段
        /// <summary>
        /// 主业务表编号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string MainBusinessTableCode { get; set; }
        /// <summary>
        /// 关联业务表编号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string RelBusinessTableCode { get; set; }

        #endregion
    }
}

